package org.jeecg.modules.enhance.java;

import java.util.Map;

import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.modules.online.cgform.enhance.CgformEnhanceJavaInter;
import org.jeecg.modules.online.config.exception.BusinessException;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;

/*
 * 款式编码
 * 
 */
@Component("StyleformEnhanceImport")
public class StyleformEnhanceImport implements CgformEnhanceJavaInter {

    
	@Override
	public int execute(String tableName, JSONObject json) throws BusinessException {
		// System.out.println(json.toString()+json.getString("code_num_key"));

		String codeNumKey = "style_code";
		JSONObject jsonObject = json;
		Object code = FillRuleUtil.executeRule(codeNumKey, jsonObject);
		System.out.println(code.toString());
		json.put("code_num", code);
		if(json.get("name")==null)
		{
			json.put("name", code);
		}

		
    	
		return 2;

	}

	@Override
	public int execute(String tableName, Map<String, Object> map) throws BusinessException {
		return 1;
	}

}